import java.util.Arrays;

/**
 * Created with IntelliJ IDEA
 * Description
 * User：chenshu
 * Date：2023-10-13
 * Time：22:38
 */
public class Work {
    public static double avg(int[] arr) {
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            sum += arr[i];
        }
        return (double)sum/ arr.length;
    }

    public static int sum(int[] arr) {
        int ret = 0;
        for (int i = 0; i < arr.length; i++) {
            ret+=arr[i];
        }
        return ret;
    }
    public static void transform(int[] arr){
        for (int i = 0; i < arr.length; i++) {
            arr[i] *= 2;
        }
    }
    public static void printArr(int[] arr) {
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
    }
    public static int[] copyOf(int[] arr) {
        int[] copy = new int[arr.length];
        for (int i = 0; i < arr.length; i++) {
            copy[i] = arr[i];
        }
        return copy;
    }
    public static void main(String[] args) {
        int[] arr = {1,2,3,4};
        int[] copy;
        copy = copyOf(arr);
        printArr(copy);
        /*int[] arr = new int[100];
        arr[0] = 1;
        for (int i = 1; i < arr.length; i++) {
            if (i % 2 == 0){
                arr[i] = 1;
            } else {
                arr[i] = -100;
            }
        }
        printArr(arr);*/
    }
}
